package hc.bre.calc.scorecard


import hc.bre.ComponentConfig
import hc.bre.cmn.ListOption
import hc.bre.cmn.RuleScriptBuilder
import hc.bre.cmn.RuleDefinition
import hc.bre.cmn.struct.DataStruct

@groovy.transform.CompileStatic
@groovy.transform.ToString(includeNames=true,includePackage=false)
class ScorecardDefinition extends RuleDefinition{
	public static final ComponentConfig _config ;
	static
	{
		_config = new ComponentConfig();
		_config.rtype = 'rule:calc:scorecard';
		_config.rname = '评分卡';
		_config.builderClass = ScBuilder;
		_config.resultStruct = new hc.bre.calc.scorecard.ScResultStruct();
		_config.objectpage = '/rule/calc/ScorecardEditor.htm?rpath=${rpath}';
		_config.description = '评分卡通过多个变量或条件进行综合评分。';
	}
	BigDecimal score = 0 ;

	Integer transform;

	List<ScBranchItem> list = [];

	@Override
	public ScorecardDefinition load(Map map) {
		super.load(map);

		this.score = map.get('score') as BigDecimal;
		this.transform = map.get('transform') as Integer;

		list = hc.Util.loadList(map['list'],ScBranchItem.class)

		return this;
	}
}